<template>
  <div style="height: auto; background-color: #fff; padding: 10px 20px; display: flex; flex-direction: column;">
    <span style="font-size: 20px;">住院结算</span>
    <div style="display: flex; flex-direction: row; align-items: center; margin-top: 10px;">
      <el-input placeholder="请输入姓名" style="width: 200px;" v-model="selectall.name"/>
      <el-form-item  style="margin: 0 10px">
        <el-date-picker placeholder="请选择入院日期" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" v-model="selectall.admissionTime"/>
      </el-form-item>
      <el-button style="margin-left: 10px;"color="#D3D3D3" @click="select" >查询</el-button>
      <el-button>重置</el-button>
    </div>
  </div>
    <el-table :data="selectArr">
      <el-table-column type="index" label="编号" width="160px"/>
      <el-table-column prop="name" label="患者姓名" width="160px"/>
      <el-table-column prop="feesDue" label="应缴金额" width="160px"/>
      <el-table-column prop="prepayment" label="预交金额" width="160px"/>
      <el-table-column prop="settlementStatus" label="结算状态" width="160px"/>
      <el-table-column prop="MiPay" label="医保统筹基金支付金额" width="170px"/>
      <el-table-column prop="otherPay" label="其他基金支付金额" width="170px"/>
      <el-table-column prop="perMiPay" label="医保个人账户支付金额" width="170px"/>
      <el-table-column prop="personalPay" label="个人现金支付金额" width="160px"/>
      <el-table-column prop="payMethod" label="支付方式" width="160px"/>
      <el-table-column prop="tollMethod" label="收费流水号" width="160px"/>
      <el-table-column prop="settlementTime" label="结算时间" width="160px"/>
      <el-table-column prop="settlementPatientId" label="结算人员id" width="160px"/>
      <el-table-column prop="operate" label="操作" width="160px"/>
    </el-table>
</template>


<script setup>
import qs from "qs";
import axios from "axios";
import {ElMessage} from "element-plus";
import {onMounted, ref} from "vue";



//定义数组用来保存用户列表数据
const selectArr = ref([

]);
//定义对象用来保存查询条件
const selectall = ref({name:'',admissionTime:'',departmentName:''});
//定义加载用户数据的方法
const select = ()=>{
  let data = qs.stringify(selectall.value)
  console.log(data);
  //如果有查询条件,就根据条件查,没有查询条件,默认查全部员工信息
  axios.get(BASE_URL+'v1/Settlement/select?'+data).then((response)=>{
    //如果后端返回的状态码是2000,说明成功了
    if(response.data.code==2000){
      //把成功请求回来的数据装到与表格绑定的数组中
      console.log(response.data.data);
      selectArr.value = response.data.data;
    }else{
      ElMessage.error(response.data.msg);
    }
  })
}
onMounted(()=>{
  select();
})

</script>

<style scoped>

</style>

